CPP=g++
MAKE=make

CORELIB_NAME = libkport2.so
CORELIB_FILES = src/transport.cpp src/routingtable.cpp src/listner.cpp src/speaker.cpp
CORELIB_OBJECTS	= $(CORELIB_FILES:src/%.cpp=%.o)

CORELIB_COMPILE_FLAGS = -Wall -rdynamic -fPIC -I../libpland/lib/ -I../tinyxml/ -O2
CORELIB_LINK_FLAGS = -shared -Wl,-soname,$(CORELIB_NAME) -o $(CORELIB_NAME) -lboost_thread -L../libpland -lpland -rdynamic

all: slib

system: slib
	cp $(CORELIB_NAME) ../build

%.o: src/%.cpp
	$(CPP) $(CORELIB_COMPILE_FLAGS) -c -o $@  $< $(CXXFLAGS)

slib: $(CORELIB_OBJECTS)
	$(CPP) $(CORELIB_LINK_FLAGS) $(CORELIB_OBJECTS)

test: $(CORELIB_OBJECTS)
	$(CPP) $(CORELIB_COMPILE_FLAGS) -c main.cpp -o main.o
	$(CPP) $(CORELIB_OBJECTS) main.o -o testbench -L../tinyxml -L../libpland/ -lpland -lboost_thread -ltinyxml -lpthread -fPIC -Wl,--rpath,. -rdynamic

.PHONY	: clean open

clean:
	rm -rf *.o $(CORELIB_NAME) testbench doc/ log.txt
open:
	geany  src/*.cpp lib/*.hpp &
